import React from "react";
const onref=React.createRef()
class inputs extends React.Component{
  state = {
    text: '123',
    content:'12345'
  }
  handel = (e) => {
    this.setState({
      [e.target.name]: e.target.value
    })
    console.log(e.target.value);
  }
  clicks = () => {
    console.log(onref.current.value);
  }
  render() {
    return (
      <div>
        <input type={"text"} name='text' value={this.state.text} onChange={this.handel} />
        <br></br>
        <textarea name='content' value={this.state.content} onChange={this.handel}></textarea>
        <hr />
        <input type="text" ref={onref}/>
        <hr />
        <button name="btn" onClick={this.clicks}>点击</button>
      </div>
    )
  }
}
export default inputs
